
<template>
	<view >		
		<scroll-view scroll-y class="page">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="backText"></block>
				<block slot="content">通知消息</block>				
			</cu-custom>
			<!-- list列表 -->
			<view style="padding: 10px 10px 0  10px;">
			
			<view class="cu-list menu">	
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
					<view class="content">
						<text class="text-grey">主题</text>
					</view>
					<view class="action">
						<text class="text-grey">{{msgForm.title}}</text>						
					</view>
				</view>
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.1s'}]">
					<view class="content">
						<text class="text-grey">时间</text>
					</view>
					<view class="action">
						<text class="text-grey">{{msgForm.time}}</text>						
					</view>
				</view>
			</view>	
			<view class="cu-list menu">				
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
					<view class="content">
						<text class="text-grey">内容</text>
					</view>
					<view class="action">
						<textarea   name="input" v-model="msgForm.content" disabled></textarea>						
					</view>
				</view>
			</view>
		</view>
		</scroll-view>
	</view>
</template>

<script>
	import api from '@/api/api.js'
	export default {
		data() {
			return {
				toggleStatus: false,
				searchVal: '',
				loading: false,
				msgForm:{
					title:'',
					accCode:'',
					openid:'',
					content:''
				},
				msgUrl:'/mp/jwWebJwid/getMsg',
			};			
		},
		onLoad() {
		},
		created(){
		   initMsg();
		},
		methods: {
			initMsg(){
				var msgId= this.getQueryVariable("msgId")
				if(!msgId){
					//无效id
					this.$Router.replaceAll({name:'home'})
				}else{
					var paramObj={
						"id": msgId
					}
					// 请求消息ID
					this.$http.post(this.msgUrl,paramObj).then(res=>{
						if (res.data.success) {
							var msgObj=res.data.result;
							this.msgForm.title = msgObj..titile;
							this.msgForm.time = msgObj.sendTime;
							this.msgForm.content = msgObj.msgContent;
						}else{
							this.$tip.error(res.message)
						}
					}).catch(err => {
						console.log(err);
					});
					
				}
			},
			
			getQueryVariable(variable) {
			    var query = window.location.search.substring(1);
			    var vars = query.split("&");
			    for (var i = 0; i < vars.length; i++) {
			        var pair = vars[i].split("=");
			        if (pair[0] == variable) {
			            return pair[1];
			        }
			    }
			    return (false);
			}
		}
	}
</script>

<style>
	.page {
		height: 100Vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}
	
	.uni-group {
		display: flex;
		align-items: center;
	}
</style>
